package javaCode.chapter06.本章作业;

public class Homework08 {

    public static void main(String[] args) {

        Music m = new Music("晴天",3.15);
        m.play();
        System.out.println(m.getInfo());
    }
}

/*
定义Music类，里面有音乐名name、音乐时长times属性，
并有play功能和返回本身属性信息的功能方法getInfo
 */
class Music {
    String name;
    double times;

    public Music(String name, double times) {
        this.name = name;
        this.times = times;
    }

    //播放play功能
    public void play() {
        System.out.println("音乐 " + name + " 正在播放中... 时长为" + times + "分钟");
    }

    public String getInfo() {
        return "音乐" + name + "播放时间为" + times;
    }
}